﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CustomerOrderingSystem
{
    public partial class Stock : Form
    {
        private string sql = "";

        public Stock()
        {
            InitializeComponent();
        }

        private void Stock_Load(object sender, EventArgs e)
        {
            stockDataGridView.DataSource = sql_stock.QueryDataTable0();
        }

        private void MakeSqlStr()
        {
            {
                //清空上次的查询字符串
                sql = "";
                if (gnoTextBox.Text.Trim() != string.Empty)
                {
                    sql = " and Gno like '%" + gnoTextBox.Text.Trim() + "%'";
                }

            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MakeSqlStr();
            stockDataGridView.DataSource = sql_stock.QueryDataTable(sql);
        }
    }
}
